<?php global $ubi; ?>
<div class="blast">  
	<div class="left">
		<?php echo $user->getBlast();?>
	</div>
	<?php
	if (isset($_SESSION['userid'])) {
		if ($_SESSION['userid'] == $getVars['userid']) {
	?>
		<div class="right">
			<a href="#" id="lnkUpdateBlast">Thay đổi blast</a>
		</div>		
	<?php 
		}
	} 
	?>	
	<div style="clear:both"></div>
	<div class="img"></div>                     
</div>

<div id="dlgBlast" title="Cập nhật Blast">
	<form id="frmBlast">
		Nội dung blast :
		<textarea name="txtBlast" rows="3" cols="50"></textarea>
		<br /><br />
		<input type="submit" value="Đồng Ý"/>
		<input type="button" value="Thoát" id="btnThoat" />
	</form>	
</div>

<script language="javascript">
	$('#dlgBlast').dialog({autoOpen: false, width:'475px'});
		
	$('#lnkUpdateBlast').click(function() {				
		$('#dlgBlast').dialog('open');					
	});
	
	$('#btnThoat').click(function() {
		$('#dlgBlast').dialog('close');
	});

	$('#frmBlast').submit(function() {				
		var url = 'index.php?update&type=blast';
		var blast = $(this).find('textarea[name=txtBlast]').val();		
		
		if (blast != '') {
			$(this).find('textarea[name=txtBlast]').val('');			
			$.post(url, 
				{blast:blast}, 
				function(data) {
					$('#dlgBlast').dialog('close');								
					$('#userBlast').load('index.php?load&view=userBlast&userid=<?php echo $getVars['userid']?>');																				
				}
			);
		}
		return false;
	});
</script>